package com.zbl.zblproject.erp.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbl.zblproject.erp.entity.ErpWarehouseItem;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author youlanqiang
 * @version 1.0
 * @date 2018/10/12
 */
@Repository
public interface ErpWarehouseItemMapper extends BaseMapper<ErpWarehouseItem> {

    /**
     * 仓库减库存
     * @param goodsId 商品ID
     * @param whId 仓库ID
     * @param num   减数量
     * @return
     */
    boolean subGoodsNumber(@Param("goodsId") int goodsId, @Param("whId") int whId, @Param("num") int num);

    Integer getGoodsNumber(int goodsId);

    Integer getGoodsNumberNotWhId(@Param("goodsId") int goodsId, @Param("whId") int whId);

    Integer getGoodsNumberByWhId(@Param("goodsId") int goodsId, @Param("whId") int whId);

    /**
     * 查询货架上的商品
     * @param goodsId 商品ID
     * @param whId    货架ID
     * @return
     */
    ErpWarehouseItem selectItemByGoodsIdAndWhId(@Param("goodsId") int goodsId,@Param("whId") int whId);

    /**
     * 查询商品在货架上信息
     * @param goodsId 商品ID
     * @return
     */
    List<ErpWarehouseItem> selectItemByGoodsId(int goodsId);




}
